package com.io.computer_practice_sjlx;
import java.io.*;
//ʹ��FileInputStream��FileOutputStream �����ı��ļ�
public class FileInputStreamDemo {
	public static void main(String[] args) throws IOException {
		String content="hello";
		FileInputStream fis=null;
		FileOutputStream fos = null;
		try {
			//1.��������������, �����ȡ�ı��ļ�
			 fis = new FileInputStream("D:\\�ҵ��ഺ˭����.txt");
			//2.�������������, �����ļ�����д�뵽ָ���ı��ļ���(���ļ�ĩβ׷��)
			 fos = new FileOutputStream("D:\\�ҵ��ഺ������.txt",false);
			//3.������תվ����,���ÿ�ζ�ȡ������
			byte[] words = content.getBytes();//�ֽ�����
			while( fis.read() != -1){
				fis.read(words);//��ȡ�ļ�
				fos.write(words, 0, words.length);//д���ļ�
				//System.out.println(words);
			}
			System.out.println();
			System.out.println("�����ļ��ɹ�");
			
			
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
				try {
					fos.close();//�ر��ļ������
				} catch (FileNotFoundException e) {//�����쳣
					e.printStackTrace();
				}
			
			
		}
		
	}

}
